import { defineStore } from "pinia";
import type { spuInfoType } from "./interface/index";
interface spuStateType {
  category1Id: number | undefined;
  category2Id: number | undefined;
  category3Id: number | undefined;
  skuInfo: spuInfoType;
}
export const useSpuStore = defineStore({
  id: "useSpuStore",
  state: (): spuStateType => ({
    category1Id: undefined,
    category2Id: undefined,
    category3Id: undefined,
    skuInfo: {
      id: undefined,
      description: "",
      spuName: "",
      tmId: undefined,
    },
  }),
  actions: {
    addSpuInfo({ id, description, spuName, tmId }: spuInfoType) {
      this.$state.skuInfo.id = id;
      this.$state.skuInfo.description = description;
      this.$state.skuInfo.spuName = spuName;
      this.$state.skuInfo.tmId = tmId;
    },
  },
});
